package com.xiang.sql.mapper;

import com.xiang.sql.entity.Voucher;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * 代金券 Mapper 接口
 * 
 * @author mac-xiang
 */
public interface VoucherMapper extends BaseMapper<Voucher> {
  @Select({
      // "SELECT a.*, b.gid,d.name _group_name, b.goods, c.name _goods_name, c.money
      // _goods_money",
      "SELECT a.*",
      "FROM `voucher` a",
      // "LEFT JOIN `stock` b ON b.id = a.`stock`",
      // "LEFT JOIN `goods` c ON c.id = b.`goods`",
      // "LEFT JOIN `group` d ON d.id = b.`gid`",
      "${ew.customSqlSegment}"
  })
  List<Voucher> selectList2(@Param("ew") Wrapper<Voucher> queryWrapper);

  @Select({
      "SELECT COUNT(*) AS total FROM `voucher` a",
      "${ew.customSqlSegment}"
  })
  Long count2(@Param("ew") Wrapper<Voucher> queryWrapper);

}